<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" layout:decorator="base/layout.html">

    <!-- start: Content -->
    <div layout:fragment="content" class="main sidebar-minified">

        <div class="row">
            <div class="col-lg-12">
                <ol class="breadcrumb">
                    <li><i class="fa fa-home"></i><a th:href="@{../infoManage/indexTotal}">首页</a></li>
                    <li><i class="fa fa-table"></i>信息发布管理</li>
                </ol>
            </div>
        </div>


        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h2><i class="fa fa-indent red"></i><strong>查询信息</strong></h2>
                    </div>
                    <div class="panel-body">
                        <form id="modularForm" th:action="@{../infoManage/queryInfoManage}"  method="post" class="form-horizontal " role="form">

                            <div class="form-group">
                                <label class="col-lg-2 col-md-2 col-sm-12 control-label">标题</label>

                                <div class="col-lg-10 col-md-10">
                                    <div class="row">
                                        <div class="col-lg-2 col-md-2">
                                            <input type="text" id="titleInfo" name="title" class="form-control" th:value="${queryMap['title']}">
                                        </div>


                                        <label class="col-lg-2 col-md-2 col-sm-12 control-label">发布时间</label>
                                        <div class="col-lg-2 col-md-2">
                                            <input type="text" class="form-control date-picker" id="beginPublish" name="beginPublish" readonly th:value="${queryMap['beginPublish']}" placeholder="起始时间">

                                        </div>
                                        <label class="col-lg-1 col-md-1 col-sm-1 control-label" style="text-align: center">-</label>
                                        <div class="col-lg-2 col-md-2">
                                            <input type="text" class="form-control date-picker" id="endPublish" name="endPublish" readonly th:value="${queryMap['endPublish']}" placeholder="终止时间">
                                        </div>

                                        <button id="submitBtn" type="submit" class="btn btn-sm btn-success"><i class="fa fa-dot-circle-o"></i> 查询</button>
                                        <button id="resetBtn" type="button" class="btn btn-sm btn-danger"><i class="fa fa-ban"></i> 重置</button>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div><!--.col-->
        </div><!--.row-->

        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h2><i class="fa fa-table red"></i><span class="break"></span><strong>信息发布管理</strong></h2>

                    </div>
                    <div class="panel-body">
                        <table class="table table-striped table-bordered bootstrap-datatable datatable">
                            <thead>
                            <tr>
                                <td>序号</td>
                                <th>标题</th>
                                <th>录入时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                                <tr th:each="infoManage,state  : ${infoManageList}">
                                    <td th:text="${state.index+1}"></td>
                                    <td th:text="${infoManage.title}"></td>
                                    <td th:text="${#dates.format(infoManage.entertime,'yyyy-MM-dd HH:mm:ss')}"></td>
                                    <td>
                                        <a class="btn btn-success"  th:onclick="'layerOpen(\'toInfoManageDetail?id='+${infoManage.id}+'\')'">
                                            <i class="fa fa-search-plus "></i>
                                        </a>
                                        <a class="btn btn-info"th:href="@{../infoManage/toInfoManageUpdate(id=${infoManage.id})}">
                                            <i class="fa fa-edit "></i>
                                        </a>
                                        <a class="btn btn-danger" th:onclick="'deleteInfoManage('+${infoManage.id}+')'">
                                            <i class="fa fa-trash-o "></i>
                                        </a>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                        <!-- 分页 -->
                        <div th:unless="${#lists.isEmpty(infoManageList)}">
                            <div
                                    th:replace="base/pagination :: pagination('queryInfoManage')"></div>
                        </div>
                    </div>
                </div>
            </div><!--/col-->
        </div><!--/row-->

        <script>
            $(document).ready(function () {
                //加载时间控件
                setDatePicker("#beginPublish");
                setDatePicker("#endPublish");
            });

            function deleteInfoManage(id) {

                layer.confirm('确认删除？', {
                    btn: ['确认','取消'] //按钮
                }, function(index){
                    //确认
                    //首先关闭弹窗
                    layer.close(index);
                    $.ajax({
                        url:'deleteInfoManage',
                        type:'get',
                        data:'id='+id,
                        success:function () {
                            layer.msg("删除成功!");
                            location.reload();
                        }
                    })
                }, function(){
                    //取消
                });
            }
            //重置按钮
            $("#resetBtn").on("click",function(){
                $("#titleInfo").val("");
                $("#beginPublish").val("");
                $("#endPublish").val("");
            });
        </script>
    </div>
    <!-- end: Content -->






